{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from detectron2.data.datasets.coco import convert_to_coco_dict, load_coco_json"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loading annotations into memory...\n",
      "Done (t=13.10s)\n",
      "creating index...\n",
      "index created!\n"
     ]
    }
   ],
   "source": [
    "from pycocotools.coco import COCO\n",
    "json_file = 'detectron2_repo/datasets/coco/annotations/instances_train2017.json'\n",
    "coco_api = COCO(json_file)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "cat_ids = sorted(coco_api.getCatIds())\n",
    "cats = coco_api.loadCats(cat_ids)\n",
    "# The categories in a custom json file may not be sorted.\n",
    "thing_classes = [c[\"name\"] for c in sorted(cats, key=lambda x: x[\"id\"])]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[9,\n",
       " 25,\n",
       " 30,\n",
       " 34,\n",
       " 36,\n",
       " 42,\n",
       " 49,\n",
       " 61,\n",
       " 64,\n",
       " 71,\n",
       " 72,\n",
       " 73,\n",
       " 74,\n",
       " 77,\n",
       " 78,\n",
       " 81,\n",
       " 86,\n",
       " 89,\n",
       " 92,\n",
       " 94,\n",
       " 109,\n",
       " 110,\n",
       " 113,\n",
       " 127,\n",
       " 133,\n",
       " 136,\n",
       " 138,\n",
       " 142,\n",
       " 143,\n",
       " 144,\n",
       " 149,\n",
       " 151,\n",
       " 154,\n",
       " 164,\n",
       " 165,\n",
       " 192,\n",
       " 194,\n",
       " 196,\n",
       " 201,\n",
       " 208,\n",
       " 241,\n",
       " 247,\n",
       " 250,\n",
       " 257,\n",
       " 260,\n",
       " 263,\n",
       " 283,\n",
       " 294,\n",
       " 307,\n",
       " 308,\n",
       " 309,\n",
       " 312,\n",
       " 315,\n",
       " 321,\n",
       " 322,\n",
       " 326,\n",
       " 328,\n",
       " 332,\n",
       " 338,\n",
       " 349,\n",
       " 357,\n",
       " 359,\n",
       " 360,\n",
       " 368,\n",
       " 370,\n",
       " 382,\n",
       " 384,\n",
       " 387,\n",
       " 389,\n",
       " 394,\n",
       " 395,\n",
       " 397,\n",
       " 400,\n",
       " 404,\n",
       " 415,\n",
       " 419,\n",
       " 428,\n",
       " 431,\n",
       " 436,\n",
       " 438,\n",
       " 443,\n",
       " 446,\n",
       " 450,\n",
       " 459,\n",
       " 471,\n",
       " 472,\n",
       " 474,\n",
       " 486,\n",
       " 488,\n",
       " 490,\n",
       " 491,\n",
       " 502,\n",
       " 508,\n",
       " 510,\n",
       " 514,\n",
       " 520,\n",
       " 529,\n",
       " 531,\n",
       " 532,\n",
       " 536,\n",
       " 540,\n",
       " 542,\n",
       " 544,\n",
       " 560,\n",
       " 562,\n",
       " 564,\n",
       " 569,\n",
       " 572,\n",
       " 575,\n",
       " 581,\n",
       " 584,\n",
       " 589,\n",
       " 590,\n",
       " 595,\n",
       " 597,\n",
       " 599,\n",
       " 605,\n",
       " 612,\n",
       " 620,\n",
       " 623,\n",
       " 625,\n",
       " 626,\n",
       " 629,\n",
       " 634,\n",
       " 636,\n",
       " 641,\n",
       " 643,\n",
       " 650,\n",
       " 656,\n",
       " 659,\n",
       " 661,\n",
       " 670,\n",
       " 671,\n",
       " 673,\n",
       " 675,\n",
       " 681,\n",
       " 684,\n",
       " 690,\n",
       " 692,\n",
       " 693,\n",
       " 699,\n",
       " 706,\n",
       " 711,\n",
       " 714,\n",
       " 715,\n",
       " 716,\n",
       " 722,\n",
       " 723,\n",
       " 730,\n",
       " 731,\n",
       " 735,\n",
       " 753,\n",
       " 754,\n",
       " 757,\n",
       " 761,\n",
       " 762,\n",
       " 764,\n",
       " 772,\n",
       " 775,\n",
       " 781,\n",
       " 790,\n",
       " 795,\n",
       " 797,\n",
       " 801,\n",
       " 810,\n",
       " 813,\n",
       " 821,\n",
       " 825,\n",
       " 827,\n",
       " 828,\n",
       " 831,\n",
       " 836,\n",
       " 839,\n",
       " 853,\n",
       " 873,\n",
       " 882,\n",
       " 897,\n",
       " 901,\n",
       " 902,\n",
       " 908,\n",
       " 909,\n",
       " 913,\n",
       " 923,\n",
       " 925,\n",
       " 927,\n",
       " 934,\n",
       " 939,\n",
       " 941,\n",
       " 943,\n",
       " 955,\n",
       " 960,\n",
       " 962,\n",
       " 965,\n",
       " 969,\n",
       " 974,\n",
       " 977,\n",
       " 982,\n",
       " 984,\n",
       " 985,\n",
       " 987,\n",
       " 996,\n",
       " 999,\n",
       " 1006,\n",
       " 1011,\n",
       " 1014,\n",
       " 1025,\n",
       " 1029,\n",
       " 1036,\n",
       " 1053,\n",
       " 1059,\n",
       " 1063,\n",
       " 1064,\n",
       " 1072,\n",
       " 1083,\n",
       " 1084,\n",
       " 1085,\n",
       " 1089,\n",
       " 1090,\n",
       " 1098,\n",
       " 1099,\n",
       " 1102,\n",
       " 1103,\n",
       " 1107,\n",
       " 1108,\n",
       " 1111,\n",
       " 1122,\n",
       " 1138,\n",
       " 1139,\n",
       " 1144,\n",
       " 1145,\n",
       " 1146,\n",
       " 1149,\n",
       " 1153,\n",
       " 1155,\n",
       " 1164,\n",
       " 1166,\n",
       " 1168,\n",
       " 1171,\n",
       " 1176,\n",
       " 1180,\n",
       " 1183,\n",
       " 1200,\n",
       " 1204,\n",
       " 1205,\n",
       " 1213,\n",
       " 1216,\n",
       " 1224,\n",
       " 1228,\n",
       " 1232,\n",
       " 1237,\n",
       " 1238,\n",
       " 1244,\n",
       " 1261,\n",
       " 1264,\n",
       " 1270,\n",
       " 1271,\n",
       " 1282,\n",
       " 1290,\n",
       " 1292,\n",
       " 1295,\n",
       " 1298,\n",
       " 1306,\n",
       " 1307,\n",
       " 1308,\n",
       " 1311,\n",
       " 1315,\n",
       " 1319,\n",
       " 1323,\n",
       " 1330,\n",
       " 1332,\n",
       " 1340,\n",
       " 1342,\n",
       " 1347,\n",
       " 1350,\n",
       " 1355,\n",
       " 1359,\n",
       " 1360,\n",
       " 1366,\n",
       " 1369,\n",
       " 1374,\n",
       " 1375,\n",
       " 1381,\n",
       " 1386,\n",
       " 1390,\n",
       " 1392,\n",
       " 1393,\n",
       " 1397,\n",
       " 1398,\n",
       " 1401,\n",
       " 1403,\n",
       " 1404,\n",
       " 1407,\n",
       " 1408,\n",
       " 1424,\n",
       " 1431,\n",
       " 1436,\n",
       " 1442,\n",
       " 1448,\n",
       " 1451,\n",
       " 1453,\n",
       " 1455,\n",
       " 1464,\n",
       " 1472,\n",
       " 1488,\n",
       " 1496,\n",
       " 1497,\n",
       " 1501,\n",
       " 1505,\n",
       " 1507,\n",
       " 1510,\n",
       " 1515,\n",
       " 1518,\n",
       " 1522,\n",
       " 1523,\n",
       " 1525,\n",
       " 1526,\n",
       " 1527,\n",
       " 1536,\n",
       " 1548,\n",
       " 1554,\n",
       " 1558,\n",
       " 1561,\n",
       " 1562,\n",
       " 1563,\n",
       " 1569,\n",
       " 1573,\n",
       " 1577,\n",
       " 1579,\n",
       " 1580,\n",
       " 1586,\n",
       " 1589,\n",
       " 1590,\n",
       " 1591,\n",
       " 1592,\n",
       " 1596,\n",
       " 1599,\n",
       " 1611,\n",
       " 1622,\n",
       " 1625,\n",
       " 1626,\n",
       " 1637,\n",
       " 1639,\n",
       " 1645,\n",
       " 1647,\n",
       " 1655,\n",
       " 1667,\n",
       " 1668,\n",
       " 1670,\n",
       " 1674,\n",
       " 1681,\n",
       " 1682,\n",
       " 1688,\n",
       " 1697,\n",
       " 1700,\n",
       " 1706,\n",
       " 1709,\n",
       " 1712,\n",
       " 1720,\n",
       " 1722,\n",
       " 1732,\n",
       " 1737,\n",
       " 1739,\n",
       " 1756,\n",
       " 1757,\n",
       " 1762,\n",
       " 1764,\n",
       " 1771,\n",
       " 1774,\n",
       " 1777,\n",
       " 1779,\n",
       " 1781,\n",
       " 1785,\n",
       " 1786,\n",
       " 1790,\n",
       " 1792,\n",
       " 1799,\n",
       " 1803,\n",
       " 1804,\n",
       " 1810,\n",
       " 1811,\n",
       " 1813,\n",
       " 1815,\n",
       " 1822,\n",
       " 1837,\n",
       " 1840,\n",
       " 1841,\n",
       " 1852,\n",
       " 1856,\n",
       " 1864,\n",
       " 1869,\n",
       " 1875,\n",
       " 1877,\n",
       " 1888,\n",
       " 1895,\n",
       " 1900,\n",
       " 1902,\n",
       " 1903,\n",
       " 1906,\n",
       " 1907,\n",
       " 1911,\n",
       " 1912,\n",
       " 1915,\n",
       " 1924,\n",
       " 1926,\n",
       " 1941,\n",
       " 1942,\n",
       " 1943,\n",
       " 1947,\n",
       " 1948,\n",
       " 1955,\n",
       " 1958,\n",
       " 1960,\n",
       " 1966,\n",
       " 1987,\n",
       " 1994,\n",
       " 1997,\n",
       " 1999,\n",
       " 2001,\n",
       " 2007,\n",
       " 2014,\n",
       " 2024,\n",
       " 2055,\n",
       " 2056,\n",
       " 2061,\n",
       " 2066,\n",
       " 2068,\n",
       " 2072,\n",
       " 2083,\n",
       " 2089,\n",
       " 2093,\n",
       " 2106,\n",
       " 2114,\n",
       " 2124,\n",
       " 2135,\n",
       " 2139,\n",
       " 2142,\n",
       " 2148,\n",
       " 2150,\n",
       " 2154,\n",
       " 2164,\n",
       " 2171,\n",
       " 2178,\n",
       " 2179,\n",
       " 2184,\n",
       " 2191,\n",
       " 2193,\n",
       " 2197,\n",
       " 2209,\n",
       " 2211,\n",
       " 2212,\n",
       " 2217,\n",
       " 2225,\n",
       " 2229,\n",
       " 2232,\n",
       " 2235,\n",
       " 2239,\n",
       " 2240,\n",
       " 2244,\n",
       " 2255,\n",
       " 2258,\n",
       " 2270,\n",
       " 2276,\n",
       " 2278,\n",
       " 2279,\n",
       " 2280,\n",
       " 2281,\n",
       " 2283,\n",
       " 2284,\n",
       " 2290,\n",
       " 2295,\n",
       " 2296,\n",
       " 2302,\n",
       " 2309,\n",
       " 2315,\n",
       " 2337,\n",
       " 2342,\n",
       " 2346,\n",
       " 2347,\n",
       " 2349,\n",
       " 2369,\n",
       " 2372,\n",
       " 2374,\n",
       " 2377,\n",
       " 2388,\n",
       " 2389,\n",
       " 2400,\n",
       " 2402,\n",
       " 2411,\n",
       " 2415,\n",
       " 2429,\n",
       " 2434,\n",
       " 2444,\n",
       " 2445,\n",
       " 2446,\n",
       " 2448,\n",
       " 2451,\n",
       " 2453,\n",
       " 2459,\n",
       " 2466,\n",
       " 2470,\n",
       " 2471,\n",
       " 2477,\n",
       " 2495,\n",
       " 2496,\n",
       " 2498,\n",
       " 2521,\n",
       " 2525,\n",
       " 2529,\n",
       " 2531,\n",
       " 2536,\n",
       " 2543,\n",
       " 2544,\n",
       " 2545,\n",
       " 2555,\n",
       " 2559,\n",
       " 2560,\n",
       " 2562,\n",
       " 2563,\n",
       " 2567,\n",
       " 2570,\n",
       " 2575,\n",
       " 2583,\n",
       " 2585,\n",
       " 2591,\n",
       " 2602,\n",
       " 2606,\n",
       " 2608,\n",
       " 2613,\n",
       " 2614,\n",
       " 2618,\n",
       " 2619,\n",
       " 2621,\n",
       " 2623,\n",
       " 2624,\n",
       " 2639,\n",
       " 2640,\n",
       " 2644,\n",
       " 2645,\n",
       " 2658,\n",
       " 2664,\n",
       " 2672,\n",
       " 2684,\n",
       " 2686,\n",
       " 2687,\n",
       " 2690,\n",
       " 2691,\n",
       " 2693,\n",
       " 2697,\n",
       " 2703,\n",
       " 2732,\n",
       " 2742,\n",
       " 2752,\n",
       " 2753,\n",
       " 2754,\n",
       " 2755,\n",
       " 2758,\n",
       " 2759,\n",
       " 2764,\n",
       " 2770,\n",
       " 2774,\n",
       " 2776,\n",
       " 2782,\n",
       " 2822,\n",
       " 2823,\n",
       " 2833,\n",
       " 2839,\n",
       " 2842,\n",
       " 2843,\n",
       " 2849,\n",
       " 2860,\n",
       " 2867,\n",
       " 2881,\n",
       " 2886,\n",
       " 2890,\n",
       " 2892,\n",
       " 2894,\n",
       " 2896,\n",
       " 2902,\n",
       " 2907,\n",
       " 2931,\n",
       " 2951,\n",
       " 2963,\n",
       " 2964,\n",
       " 2972,\n",
       " 2982,\n",
       " 2983,\n",
       " 2985,\n",
       " 2988,\n",
       " 2989,\n",
       " 2992,\n",
       " 2998,\n",
       " 3000,\n",
       " 3001,\n",
       " 3003,\n",
       " 3008,\n",
       " 3014,\n",
       " 3035,\n",
       " 3040,\n",
       " 3048,\n",
       " 3067,\n",
       " 3076,\n",
       " 3077,\n",
       " 3080,\n",
       " 3084,\n",
       " 3091,\n",
       " 3093,\n",
       " 3103,\n",
       " 3109,\n",
       " 3118,\n",
       " 3124,\n",
       " 3125,\n",
       " 3131,\n",
       " 3134,\n",
       " 3145,\n",
       " 3148,\n",
       " 3149,\n",
       " 3157,\n",
       " 3160,\n",
       " 3178,\n",
       " 3192,\n",
       " 3197,\n",
       " 3209,\n",
       " 3217,\n",
       " 3219,\n",
       " 3220,\n",
       " 3224,\n",
       " 3225,\n",
       " 3234,\n",
       " 3236,\n",
       " 3242,\n",
       " 3244,\n",
       " 3249,\n",
       " 3259,\n",
       " 3264,\n",
       " 3270,\n",
       " 3272,\n",
       " 3276,\n",
       " 3286,\n",
       " 3293,\n",
       " 3305,\n",
       " 3310,\n",
       " 3314,\n",
       " 3320,\n",
       " 3321,\n",
       " 3325,\n",
       " 3326,\n",
       " 3335,\n",
       " 3337,\n",
       " 3342,\n",
       " 3348,\n",
       " 3353,\n",
       " 3361,\n",
       " 3365,\n",
       " 3366,\n",
       " 3375,\n",
       " 3378,\n",
       " 3382,\n",
       " 3386,\n",
       " 3389,\n",
       " 3398,\n",
       " 3412,\n",
       " 3425,\n",
       " 3432,\n",
       " 3442,\n",
       " 3457,\n",
       " 3461,\n",
       " 3464,\n",
       " 3466,\n",
       " 3474,\n",
       " 3478,\n",
       " 3480,\n",
       " 3481,\n",
       " 3483,\n",
       " 3488,\n",
       " 3493,\n",
       " 3511,\n",
       " 3514,\n",
       " 3517,\n",
       " 3518,\n",
       " 3521,\n",
       " 3528,\n",
       " 3532,\n",
       " 3535,\n",
       " 3538,\n",
       " 3579,\n",
       " 3580,\n",
       " 3590,\n",
       " 3595,\n",
       " 3602,\n",
       " 3613,\n",
       " 3623,\n",
       " 3628,\n",
       " 3637,\n",
       " 3640,\n",
       " 3668,\n",
       " 3671,\n",
       " 3682,\n",
       " 3685,\n",
       " 3690,\n",
       " 3692,\n",
       " 3693,\n",
       " 3694,\n",
       " 3703,\n",
       " 3711,\n",
       " 3713,\n",
       " 3716,\n",
       " 3729,\n",
       " 3735,\n",
       " 3737,\n",
       " 3742,\n",
       " 3745,\n",
       " 3751,\n",
       " 3761,\n",
       " 3764,\n",
       " 3770,\n",
       " 3771,\n",
       " 3779,\n",
       " 3782,\n",
       " 3786,\n",
       " 3789,\n",
       " 3793,\n",
       " 3794,\n",
       " 3799,\n",
       " 3804,\n",
       " 3812,\n",
       " 3817,\n",
       " 3823,\n",
       " 3827,\n",
       " 3830,\n",
       " 3832,\n",
       " 3837,\n",
       " 3849,\n",
       " 3860,\n",
       " 3862,\n",
       " 3865,\n",
       " 3866,\n",
       " 3867,\n",
       " 3870,\n",
       " 3877,\n",
       " 3897,\n",
       " 3899,\n",
       " 3911,\n",
       " 3915,\n",
       " 3917,\n",
       " 3920,\n",
       " 3926,\n",
       " 3932,\n",
       " 3935,\n",
       " 3938,\n",
       " 3939,\n",
       " 3941,\n",
       " 3947,\n",
       " 3964,\n",
       " 3967,\n",
       " 3982,\n",
       " 3983,\n",
       " 3988,\n",
       " 3992,\n",
       " 3995,\n",
       " 3999,\n",
       " 4011,\n",
       " 4020,\n",
       " 4021,\n",
       " 4032,\n",
       " 4038,\n",
       " 4042,\n",
       " 4051,\n",
       " 4057,\n",
       " 4065,\n",
       " 4066,\n",
       " 4068,\n",
       " 4069,\n",
       " 4079,\n",
       " 4080,\n",
       " 4092,\n",
       " 4093,\n",
       " 4108,\n",
       " 4125,\n",
       " 4129,\n",
       " 4130,\n",
       " 4131,\n",
       " 4132,\n",
       " 4138,\n",
       " 4139,\n",
       " 4140,\n",
       " 4157,\n",
       " 4159,\n",
       " 4172,\n",
       " 4173,\n",
       " 4175,\n",
       " 4180,\n",
       " 4187,\n",
       " 4189,\n",
       " 4201,\n",
       " 4208,\n",
       " 4211,\n",
       " 4212,\n",
       " 4219,\n",
       " 4227,\n",
       " 4229,\n",
       " 4239,\n",
       " 4243,\n",
       " 4244,\n",
       " 4245,\n",
       " 4246,\n",
       " 4256,\n",
       " 4259,\n",
       " 4260,\n",
       " 4265,\n",
       " 4266,\n",
       " 4275,\n",
       " 4278,\n",
       " 4282,\n",
       " 4283,\n",
       " 4286,\n",
       " 4289,\n",
       " 4296,\n",
       " 4308,\n",
       " 4309,\n",
       " 4312,\n",
       " 4318,\n",
       " 4319,\n",
       " 4322,\n",
       " 4331,\n",
       " 4338,\n",
       " 4355,\n",
       " 4359,\n",
       " 4360,\n",
       " 4375,\n",
       " 4376,\n",
       " 4377,\n",
       " 4385,\n",
       " 4386,\n",
       " 4392,\n",
       " 4394,\n",
       " 4396,\n",
       " 4404,\n",
       " 4410,\n",
       " 4415,\n",
       " 4421,\n",
       " 4424,\n",
       " 4426,\n",
       " 4428,\n",
       " 4438,\n",
       " 4441,\n",
       " 4442,\n",
       " 4444,\n",
       " 4462,\n",
       " 4463,\n",
       " 4471,\n",
       " 4477,\n",
       " 4478,\n",
       " 4481,\n",
       " 4488,\n",
       " 4489,\n",
       " 4490,\n",
       " 4497,\n",
       " 4498,\n",
       " 4502,\n",
       " 4508,\n",
       " 4509,\n",
       " 4517,\n",
       " 4527,\n",
       " 4535,\n",
       " 4537,\n",
       " 4546,\n",
       " 4549,\n",
       " 4551,\n",
       " 4554,\n",
       " 4555,\n",
       " 4567,\n",
       " 4571,\n",
       " 4574,\n",
       " 4575,\n",
       " 4576,\n",
       " 4578,\n",
       " 4579,\n",
       " 4587,\n",
       " 4592,\n",
       " 4595,\n",
       " 4608,\n",
       " 4616,\n",
       " 4620,\n",
       " 4622,\n",
       " 4624,\n",
       " 4642,\n",
       " 4647,\n",
       " 4662,\n",
       " 4665,\n",
       " 4673,\n",
       " 4678,\n",
       " 4684,\n",
       " 4688,\n",
       " 4694,\n",
       " 4700,\n",
       " 4702,\n",
       " 4704,\n",
       " 4705,\n",
       " 4706,\n",
       " 4711,\n",
       " 4714,\n",
       " 4716,\n",
       " 4719,\n",
       " 4731,\n",
       " 4736,\n",
       " 4739,\n",
       " 4741,\n",
       " 4742,\n",
       " 4749,\n",
       " 4754,\n",
       " 4760,\n",
       " 4761,\n",
       " 4762,\n",
       " 4764,\n",
       " 4772,\n",
       " 4785,\n",
       " 4794,\n",
       " 4796,\n",
       " 4809,\n",
       " 4820,\n",
       " 4823,\n",
       " 4827,\n",
       " 4830,\n",
       " 4834,\n",
       " 4840,\n",
       " 4843,\n",
       " 4844,\n",
       " 4859,\n",
       " 4876,\n",
       " 4880,\n",
       " 4885,\n",
       " 4888,\n",
       " 4891,\n",
       " 4893,\n",
       " 4901,\n",
       " 4903,\n",
       " 4904,\n",
       " 4916,\n",
       " 4920,\n",
       " 4931,\n",
       " 4936,\n",
       " 4947,\n",
       " 4956,\n",
       " 4963,\n",
       " 4968,\n",
       " 4970,\n",
       " 4971,\n",
       " 4972,\n",
       " 4975,\n",
       " 4978,\n",
       " 4979,\n",
       " 4980,\n",
       " 4981,\n",
       " 4984,\n",
       " 4988,\n",
       " 4993,\n",
       " 5005,\n",
       " 5010,\n",
       " 5011,\n",
       " 5016,\n",
       " 5018,\n",
       " 5021,\n",
       " 5028,\n",
       " 5032,\n",
       " 5033,\n",
       " 5038,\n",
       " 5046,\n",
       " 5064,\n",
       " 5073,\n",
       " 5076,\n",
       " 5083,\n",
       " 5085,\n",
       " 5086,\n",
       " 5088,\n",
       " 5094,\n",
       " 5095,\n",
       " 5099,\n",
       " 5105,\n",
       " 5107,\n",
       " 5111,\n",
       " 5113,\n",
       " 5115,\n",
       " 5123,\n",
       " 5124,\n",
       " 5131,\n",
       " 5139,\n",
       " 5140,\n",
       " 5142,\n",
       " 5146,\n",
       " 5151,\n",
       " 5152,\n",
       " 5154,\n",
       " 5156,\n",
       " 5165,\n",
       " 5169,\n",
       " 5172,\n",
       " 5174,\n",
       " 5178,\n",
       " 5180,\n",
       " 5184,\n",
       " ...]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "img_ids = sorted(coco_api.imgs.keys())\n",
    "img_ids"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'supercategory': 'person', 'id': 1, 'name': 'person'},\n",
       " {'supercategory': 'vehicle', 'id': 2, 'name': 'bicycle'},\n",
       " {'supercategory': 'vehicle', 'id': 3, 'name': 'car'},\n",
       " {'supercategory': 'vehicle', 'id': 4, 'name': 'motorcycle'},\n",
       " {'supercategory': 'vehicle', 'id': 5, 'name': 'airplane'},\n",
       " {'supercategory': 'vehicle', 'id': 6, 'name': 'bus'},\n",
       " {'supercategory': 'vehicle', 'id': 7, 'name': 'train'},\n",
       " {'supercategory': 'vehicle', 'id': 8, 'name': 'truck'},\n",
       " {'supercategory': 'vehicle', 'id': 9, 'name': 'boat'},\n",
       " {'supercategory': 'outdoor', 'id': 10, 'name': 'traffic light'},\n",
       " {'supercategory': 'outdoor', 'id': 11, 'name': 'fire hydrant'},\n",
       " {'supercategory': 'outdoor', 'id': 13, 'name': 'stop sign'},\n",
       " {'supercategory': 'outdoor', 'id': 14, 'name': 'parking meter'},\n",
       " {'supercategory': 'outdoor', 'id': 15, 'name': 'bench'},\n",
       " {'supercategory': 'animal', 'id': 16, 'name': 'bird'},\n",
       " {'supercategory': 'animal', 'id': 17, 'name': 'cat'},\n",
       " {'supercategory': 'animal', 'id': 18, 'name': 'dog'},\n",
       " {'supercategory': 'animal', 'id': 19, 'name': 'horse'},\n",
       " {'supercategory': 'animal', 'id': 20, 'name': 'sheep'},\n",
       " {'supercategory': 'animal', 'id': 21, 'name': 'cow'},\n",
       " {'supercategory': 'animal', 'id': 22, 'name': 'elephant'},\n",
       " {'supercategory': 'animal', 'id': 23, 'name': 'bear'},\n",
       " {'supercategory': 'animal', 'id': 24, 'name': 'zebra'},\n",
       " {'supercategory': 'animal', 'id': 25, 'name': 'giraffe'},\n",
       " {'supercategory': 'accessory', 'id': 27, 'name': 'backpack'},\n",
       " {'supercategory': 'accessory', 'id': 28, 'name': 'umbrella'},\n",
       " {'supercategory': 'accessory', 'id': 31, 'name': 'handbag'},\n",
       " {'supercategory': 'accessory', 'id': 32, 'name': 'tie'},\n",
       " {'supercategory': 'accessory', 'id': 33, 'name': 'suitcase'},\n",
       " {'supercategory': 'sports', 'id': 34, 'name': 'frisbee'},\n",
       " {'supercategory': 'sports', 'id': 35, 'name': 'skis'},\n",
       " {'supercategory': 'sports', 'id': 36, 'name': 'snowboard'},\n",
       " {'supercategory': 'sports', 'id': 37, 'name': 'sports ball'},\n",
       " {'supercategory': 'sports', 'id': 38, 'name': 'kite'},\n",
       " {'supercategory': 'sports', 'id': 39, 'name': 'baseball bat'},\n",
       " {'supercategory': 'sports', 'id': 40, 'name': 'baseball glove'},\n",
       " {'supercategory': 'sports', 'id': 41, 'name': 'skateboard'},\n",
       " {'supercategory': 'sports', 'id': 42, 'name': 'surfboard'},\n",
       " {'supercategory': 'sports', 'id': 43, 'name': 'tennis racket'},\n",
       " {'supercategory': 'kitchen', 'id': 44, 'name': 'bottle'},\n",
       " {'supercategory': 'kitchen', 'id': 46, 'name': 'wine glass'},\n",
       " {'supercategory': 'kitchen', 'id': 47, 'name': 'cup'},\n",
       " {'supercategory': 'kitchen', 'id': 48, 'name': 'fork'},\n",
       " {'supercategory': 'kitchen', 'id': 49, 'name': 'knife'},\n",
       " {'supercategory': 'kitchen', 'id': 50, 'name': 'spoon'},\n",
       " {'supercategory': 'kitchen', 'id': 51, 'name': 'bowl'},\n",
       " {'supercategory': 'food', 'id': 52, 'name': 'banana'},\n",
       " {'supercategory': 'food', 'id': 53, 'name': 'apple'},\n",
       " {'supercategory': 'food', 'id': 54, 'name': 'sandwich'},\n",
       " {'supercategory': 'food', 'id': 55, 'name': 'orange'},\n",
       " {'supercategory': 'food', 'id': 56, 'name': 'broccoli'},\n",
       " {'supercategory': 'food', 'id': 57, 'name': 'carrot'},\n",
       " {'supercategory': 'food', 'id': 58, 'name': 'hot dog'},\n",
       " {'supercategory': 'food', 'id': 59, 'name': 'pizza'},\n",
       " {'supercategory': 'food', 'id': 60, 'name': 'donut'},\n",
       " {'supercategory': 'food', 'id': 61, 'name': 'cake'},\n",
       " {'supercategory': 'furniture', 'id': 62, 'name': 'chair'},\n",
       " {'supercategory': 'furniture', 'id': 63, 'name': 'couch'},\n",
       " {'supercategory': 'furniture', 'id': 64, 'name': 'potted plant'},\n",
       " {'supercategory': 'furniture', 'id': 65, 'name': 'bed'},\n",
       " {'supercategory': 'furniture', 'id': 67, 'name': 'dining table'},\n",
       " {'supercategory': 'furniture', 'id': 70, 'name': 'toilet'},\n",
       " {'supercategory': 'electronic', 'id': 72, 'name': 'tv'},\n",
       " {'supercategory': 'electronic', 'id': 73, 'name': 'laptop'},\n",
       " {'supercategory': 'electronic', 'id': 74, 'name': 'mouse'},\n",
       " {'supercategory': 'electronic', 'id': 75, 'name': 'remote'},\n",
       " {'supercategory': 'electronic', 'id': 76, 'name': 'keyboard'},\n",
       " {'supercategory': 'electronic', 'id': 77, 'name': 'cell phone'},\n",
       " {'supercategory': 'appliance', 'id': 78, 'name': 'microwave'},\n",
       " {'supercategory': 'appliance', 'id': 79, 'name': 'oven'},\n",
       " {'supercategory': 'appliance', 'id': 80, 'name': 'toaster'},\n",
       " {'supercategory': 'appliance', 'id': 81, 'name': 'sink'},\n",
       " {'supercategory': 'appliance', 'id': 82, 'name': 'refrigerator'},\n",
       " {'supercategory': 'indoor', 'id': 84, 'name': 'book'},\n",
       " {'supercategory': 'indoor', 'id': 85, 'name': 'clock'},\n",
       " {'supercategory': 'indoor', 'id': 86, 'name': 'vase'},\n",
       " {'supercategory': 'indoor', 'id': 87, 'name': 'scissors'},\n",
       " {'supercategory': 'indoor', 'id': 88, 'name': 'teddy bear'},\n",
       " {'supercategory': 'indoor', 'id': 89, 'name': 'hair drier'},\n",
       " {'supercategory': 'indoor', 'id': 90, 'name': 'toothbrush'}]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cats = coco_api.loadCats(coco_api.getCatIds())\n",
    "cats"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "slowfast",
   "language": "python",
   "name": "slowfast"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
